﻿@model MvcCmsProjectTracker.ViewModels.BugIndexViewModel
@section HtmlHead{
}
<div id="activeprojectdisplay">
    @Html.Partial("ControlsProjectTracker/ActiveProject")
</div>
<p>    
    <a href="/projecttracker/Project/@Model.ActiveProjectID/Bug/Create" class="button">Create Issue</a>
    <a href="/projecttracker/bug/search" class="button">Search</a>
</p>
<br />
<table style="width: 100%">
    <tr>
        <th>
            Bug ID
        </th>
        <th style="width: 25%">
            Title
        </th>
        <th>
            Category
        </th>
        <th>
            Milestone
        </th>
        <th>
        </th>
        <th>
            Priority
        </th>
        <th>
        </th>
        <th>
            Status
        </th>
        <th>
        </th>
        <th>
            Creator
        </th>
        <th>
            Assigned
        </th>
        <th>
            Created
        </th>
        <th>
            Last Update
        </th>
    </tr>
    @foreach (var item in Model.Bugs)
    { 
        <tr>
            <td style="text-align: center">
                <a href="/projecttracker/Project/@Model.ActiveProjectID/Bug/Edit/@item.BugID">@item.BugID</a>
            </td>
            <td>
                <b>@item.Title </b>
            </td>
            <td>
                @if (item.ProjectCategory != null)
                {  
                    @item.ProjectCategory.Name 
                }
            </td>
            <td>
                @if (item.ProjectMilestone != null)
                {  
                    @item.ProjectMilestone.Name 
                }
            </td>
            <td>
                @if (item.ProjectMilestone != null)
                {  
                    <img src="@Url.Content(item.ProjectMilestone.ImageUrl)" alt="" />
                }
            </td>
            <td>
                @if (item.ProjectPriority != null)
                {  
                    @item.ProjectPriority.Name
                }
            </td>
            <td>
                @if (item.ProjectPriority != null)
                {  
                    <img src="@Url.Content(item.ProjectPriority.ImageUrl) " alt="" />
                }
            </td>
            <td>
                @if (item.ProjectStatus != null)
                {  
                    @item.ProjectStatus.Name 
                }
            </td>
            <td>
                @if (item.ProjectStatus != null)
                {  
                    <img src="@Url.Content(item.ProjectStatus.ImageUrl) " alt="" />
                }
            </td>
            <td>
                @item.CreatorUserName
            </td>
            <td>
                @item.AssignedTo.UserName
            </td>
            <td>
                @String.Format("{0:g}", item.DateCreated)
            </td>
            <td>
                @String.Format("{0:g}", item.LastUpdate)
            </td>
        </tr>
    }
</table>
@section ScriptContent{
}
